package cn.itcast.mapper;

import cn.itcast.pojo.Product;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.RequestBody;

@Mapper
public interface ProductMapper {
    Page<Product> findByPage(Integer page, Integer pageSize);

    @Select("select * from product where id=#{id}")
    Product findById(Integer id);

    @Insert("insert into product values(null,#{title},#{price},#{stock},#{saleNum},#{createTime},#{categoryName},#{brandName})")
    int addProduct(Product product);

    int updateProduct(Product product);

    @Delete("delete from product where id=#{id}")
    int deleteById(@Param("id") Integer id);
}
